Multi-server node service processing and consensus method and device

ABSTRACT

One example method includes sharing, from a first server of a first blockchain node in a consensus network, node configuration information with a plurality of additional servers of the first blockchain node; receiving, by the first server of the first blockchain node, a service request sent by a client, the first blockchain node and each node of a plurality of additional blockchain nodes of the consensus network comprising a corresponding plurality of servers; storing the service request in at least one service memory of the first blockchain node; obtaining, by the first blockchain node and from a registration center, at least one address of at least one server of the corresponding plurality of servers for each node of the plurality of additional blockchain nodes in the consensus network; and sending the service request to each additional blockchain node in the consensus network based on the obtained at least one address.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is a continuation of and claims the benefit of priorityof U.S. Pat. No. 10,681,175, filed Jul. 19, 2019, which is acontinuation of PCT Application No. PCT/CN2018/080461, filed on Mar. 26,2018, which claims priority to Chinese Patent Application No.201710191462.X, filed on Mar. 28, 2017, and each application is herebyincorporated by reference in its entirety.

TECHNICAL FIELD

The present application relates to the field of computer technologies,and in particular, to a service processing and consensus method anddevice.

BACKGROUND

With continuous development of computer technologies, the blockchaintechnology is more widely applied. In addition to implementing effectivedata registration, people also use the blockchain technology to providea new idea for implementing some services.

Currently, performing service processing by using the blockchaintechnology roughly includes two processes: service processing processand service consensus process. In the service processing process, ablockchain node receives a service request sent by a user, and storesthe service request in a service memory of the blockchain node. Inaddition, the blockchain node broadcasts the service request to otherblockchain nodes in a consensus network, so that the other blockchainnodes store the service request in a service memory corresponding to theother blockchain nodes after receiving the service request.

In the service consensus process, a blockchain node obtains a certainquantity of service requests from a service memory corresponding to theblockchain node, and processes the obtained service requests to obtain apreprocessing block. Then, the blockchain node broadcasts thepreprocessing block to other blockchain nodes in a consensus network, sothat the other blockchain nodes performs service consensus on thepreprocessing block after receiving the preprocessing block.

It can be learned from the previously described two processes that theprocess of a blockchain service can be effectively completed onlythrough close cooperation between blockchain nodes in the consensusnetwork. However, in practice, a blockchain node is usually restrictedby a single server, which causes relatively low stability. Once anexception, a program restart, etc., occurs in the server, the blockchainnode is unavailable, which affects stability of the entire consensusnetwork, and affects the process of a blockchain service. In addition,software and hardware resources of a single server are very limited,which causes relatively low efficiency when the blockchain node performsservice processing.

SUMMARY

Implementations of the present application provide a service processingmethod, so as to resolve problems in the existing technology thatstability is relatively poor and service processing efficiency isrelatively poor when a blockchain node performs service processing.

An implementation of the present application provides a serviceprocessing method, including the following: receiving, by a firstblockchain node and by using a server included in the first blockchainnode, a service request sent by a client, where the first blockchainnode includes a plurality of servers and at least one service memory;storing the service request in the service memory included in the firstblockchain node; and sending the service request to each secondblockchain node in a consensus network, so that each second blockchainnode stores the service request in a service memory included in thesecond blockchain node after receiving the service request, where thesecond blockchain node includes a plurality of servers and at least oneservice memory.

Implementations of the present application provide a service processingdevice, so as to resolve problems in the existing technology thatstability is relatively poor and service processing efficiency isrelatively poor when a blockchain node performs service processing.

An implementation of the present application provides a serviceprocessing device, including the following: a receiving module,configured to receive a service request sent by a client; a storagemodule, configured to store the service request in a service memorycorresponding to the service processing device; and a sending module,configured to send the service request to each second blockchain node ina consensus network, so that each second blockchain node stores theservice request in a service memory included in the second blockchainnode after receiving the service request, where the second blockchainnode includes a plurality of servers and at least one service memory.

Implementations of the present application provide a service processingmethod, so as to resolve problems in the existing technology thatstability is relatively poor and service processing efficiency isrelatively poor when a blockchain node performs service processing.

An implementation of the present application provides a serviceprocessing method, including the following: receiving, by a secondblockchain node by using a server included in the second blockchainnode, a service request sent by a first blockchain node, where thesecond blockchain node includes a plurality of servers and at least oneservice memory, and the first blockchain node includes a plurality ofservers and at least one service memory; and storing the service requestin the service memory included in the second blockchain node.

Implementations of the present application provide a service processingdevice, so as to resolve problems in the existing technology thatstability is relatively poor and service processing efficiency isrelatively poor when a blockchain node performs service processing.

An implementation of the present application provides a serviceprocessing device, including the following: a request receiving module,configured to receive a service request sent by a first blockchain node,where the first blockchain node includes a plurality of servers and atleast one service memory; and a request storage module, configured tostore the service request in a service memory corresponding to thedevice.

Implementations of the present application provide a service processingmethod, so as to resolve problems in the existing technology thatstability is relatively poor and service processing efficiency isrelatively poor when a blockchain node performs service processing.

An implementation of the present application provides a serviceprocessing method, including the following: receiving, by a client,service information entered by a user; generating a correspondingservice request based on the service information; and sending theservice request to a server included in a first blockchain node, so thatthe first blockchain node stores the received service request in aservice memory included in the first blockchain node; and sending theservice request to each second blockchain node in a consensus network,where the first blockchain node includes a plurality of servers and atleast one service memory, and the second blockchain node includes aplurality of servers and at least one service memory.

Implementations of the present application provide a service processingdevice, so as to resolve problems in the existing technology thatstability is relatively poor and service processing efficiency isrelatively poor when a blockchain node performs service processing.

An implementation of the present application provides a serviceprocessing device, including the following: an information receivingmodule, configured to receive service information entered by a user; arequest generation module, configured to generate a correspondingservice request based on the service information; and a sending module,configured to send the service request to a server included in a firstblockchain node, so that the first blockchain node stores the receivedservice request in a service memory included in the first blockchainnode; and send the service request to each second blockchain node in aconsensus network, where the first blockchain node includes a pluralityof servers and at least one service memory, and the second blockchainnode includes a plurality of servers and at least one service memory.

Implementations of the present application provide a service consensusmethod, so as to resolve problems in the existing technology thatstability is relatively poor and service processing efficiency isrelatively poor when a blockchain node performs service processing.

An implementation of the present application provides a serviceconsensus method, including the following: selecting, by a firstblockchain node, a server from a plurality of servers included in thefirst blockchain node, where the first blockchain node includes theplurality of servers and at least one service memory; obtaining at leastone service request from the service memory included in the firstblockchain node by using the selected server; and packaging the at leastone service request into a preprocessing block by using the selectedserver, and sending the preprocessing block to each second blockchainnode in a consensus network, so that each second blockchain nodeperforms service consensus on the preprocessing block, where the secondblockchain node includes a plurality of servers and at least one servicememory.

Implementations of the present application provide a service consensusdevice, so as to resolve problems in the existing technology thatstability is relatively poor and service processing efficiency isrelatively poor when a blockchain node performs service processing.

An implementation of the present application provides a serviceconsensus device, including the following: a request acquisition module,configured to obtain at least one service request from a service memorycorresponding to the device; and a sending module, configured to packagethe at least one service request into a preprocessing block, and sendthe preprocessing block to each second blockchain node in a consensusnetwork, so that each second blockchain node performs service consensuson the preprocessing block, where the second blockchain node includes aplurality of servers and at least one service memory.

Implementations of the present application provide a service consensusdevice, so as to resolve problems in the existing technology thatstability is relatively poor and service processing efficiency isrelatively poor when a blockchain node performs service processing.

An implementation of the present application provides a serviceconsensus device, including the following: a selection module,configured to select a server from a plurality of servers included in afirst blockchain node, where the first blockchain node includes theplurality of servers and at least one service memory.

Implementations of the present application provide a service consensusmethod, so as to resolve problems in the existing technology thatstability is relatively poor and service processing efficiency isrelatively poor when a blockchain node performs service processing.

An implementation of the present application provides a serviceconsensus method, including the following: obtaining, by a blockchainnode, a preprocessing block by using a first server included in theblockchain node, where the blockchain node includes a plurality ofservers and at least one service memory; and performing serviceconsensus on the preprocessing block by using the first server based oneach service request stored in the service memory included in theblockchain node.

Implementations of the present application provide a service consensusdevice, so as to resolve problems in the existing technology thatstability is relatively poor and service processing efficiency isrelatively poor when a blockchain node performs service processing.

An implementation of the present application provides a serviceconsensus device, including the following: an acquisition module,configured to obtain a preprocessing block; and a consensus module,configured to perform service consensus on the preprocessing block basedon each service request stored in a service memory corresponding to thedevice.

Implementations of the present application provide a service processingmethod, so as to resolve problems in the existing technology thatstability is relatively poor and service processing efficiency isrelatively poor when a blockchain node performs service processing.

An implementation of the present application provides a serviceprocessing method, including the following: obtaining, by a registrationcenter, addresses of a plurality of servers included in each blockchainnode in a consensus network, where each blockchain node includes theplurality of servers and at least one service memory; and sending theobtained addresses of the plurality of servers included in theblockchain node to other blockchain nodes in the consensus network and aclient for storage.

Implementations of the present application provide a service processingdevice, so as to resolve problems in the existing technology thatstability is relatively poor and service processing efficiency isrelatively poor when a blockchain node performs service processing.

An implementation of the present application provides a serviceprocessing device, including the following: an acquisition module,configured to obtain addresses of a plurality of servers included ineach blockchain node in a consensus network, where each blockchain nodeincludes the plurality of servers and at least one service memory; and asending module, configured to send the obtained addresses of theplurality of servers included in the blockchain node to other blockchainnodes in the consensus network and a client for storage.

At least one technical solution described above and used in theimplementations of the present application can achieve the followingbeneficial effects:

In the implementations of the present application, a first blockchainnode includes a plurality of servers. The first blockchain node canreceive a service request sent by a client and store the service requestby using one server included in the first blockchain node, obtain atleast one service request from a service memory included in the firstblockchain node by using the server included in the first blockchainnode, obtain a preprocessing block, and send the preprocessing block toeach second blockchain node in a consensus network by using the server,to perform service consensus on the preprocessing block by using eachsecond blockchain node. It can be ensured that the first blockchain nodeis available, provided that one server in the plurality of serversincluded in the first blockchain node is available. Therefore, stabilityof the first blockchain node in the consensus network is greatlyimproved. In addition, each server included in the first blockchain nodecan receive the service request sent by a user by using the client, andeach server can initiate service consensus to each second blockchainnode in the consensus network. Therefore, service processing efficiencyof a blockchain service is greatly improved.

BRIEF DESCRIPTION OF DRAWINGS

The accompanying drawings described here are intended to provide afurther understanding of the present application, and constitute a partof the present application. The illustrative implementations of thepresent application and descriptions of the implementations of thepresent application are intended to describe the present application,and do not constitute limitations on the present application. In theaccompanying drawings:

FIG. 1 is a schematic diagram illustrating a service consensus process,according to an implementation of the present application;

FIG. 2 is a schematic diagram of pushing an address to a client by aregistration center, according to an implementation of the presentapplication;

FIG. 3 is a schematic diagram of pushing an address of each server in asecond blockchain node to each server in a first blockchain node by aregistration center, according to an implementation of the presentapplication;

FIG. 4 is a schematic diagram of determining an identifier to beverified by a server, according to an implementation of the presentapplication;

FIG. 5 is a schematic diagram illustrating a process of performingservice consensus on a preprocessing block by a server in a secondblockchain node, according to an implementation of the presentapplication;

FIG. 6 is a schematic structural diagram illustrating a serviceprocessing device, according to an implementation of the presentapplication;

FIG. 7 is a schematic structural diagram illustrating a serviceprocessing device, according to an implementation of the presentapplication;

FIG. 8 is a schematic structural diagram illustrating a serviceprocessing device, according to an implementation of the presentapplication;

FIG. 9 is a schematic structural diagram illustrating a serviceconsensus device, according to an implementation of the presentapplication;

FIG. 10 is a schematic structural diagram illustrating a serviceconsensus device, according to an implementation of the presentapplication;

FIG. 11 is a schematic structural diagram illustrating a serviceconsensus device, according to an implementation of the presentapplication; and

FIG. 12 is a schematic structural diagram illustrating a serviceconsensus device, according to an implementation of the presentapplication.

DESCRIPTION OF IMPLEMENTATIONS

To make a person skilled in the art understand the technical solutionsin the present application better, the following clearly and completelydescribes the technical solutions in the implementations of the presentapplication with reference to the accompanying drawings in theimplementations of the present application. Apparently, the describedimplementations are merely some but not all of the implementations ofthe present application. All other implementations obtained by a personof ordinary skill in the art based on the implementations of the presentapplication without creative efforts shall fall within the protectionscope of the present application.

FIG. 1 is a schematic diagram illustrating a service consensus process,according to an implementation of the present application, specificallyincluding the following steps.

S101. A first blockchain node receives, by using a server in a pluralityof servers included in the first blockchain node, a service request sentby a client.

In this implementation of the present application, in a serviceprocessing process, a user can send a service request to a firstblockchain node by using a client. The client mentioned here can be aclient installed on an end-user device held by the user. The user canstart the client on the end-user device, and enter service informationon an interface displayed by the client to the user. After receiving theservice information entered by the user, the client can generate acorresponding service request based on service logic pre-stored in theclient, and send the service request to the first blockchain node byusing the end-user device.

Certainly, in this implementation of the present application, the usercan directly enter corresponding service information to the end-userdevice, and the end-user device can generate a corresponding servicerequest based on the service information entered by the user, and sendthe service request to the first blockchain node.

In this implementation of the present application, the first blockchainnode includes a plurality of servers (in other words, the firstblockchain node includes a server cluster, and the server cluster isequivalent to the first blockchain node), and the servers share nodeconfiguration information such as point-to-point routing table,asymmetric public/private key of a node, and node identity (ID).Therefore, for other blockchain nodes in a consensus network and theclient, operations performed by the servers in the first blockchain nodeare all considered to be performed by the first blockchain node.

Therefore, when sending the service request to the first blockchainnode, the client first needs to determine a server in the firstblockchain node that the service request should be sent to. Therefore,this implementation of the present application provides a registrationcenter. The registration center is configured to manage addresses ofservers in a blockchain node, and push the addresses of the servers tothe client. The client can randomly select an address from the addressespushed by the registration center, and send the service request to aserver corresponding to the address, which is shown in FIG. 2.

FIG. 2 is a schematic diagram of pushing an address to a client by aregistration center, according to an implementation of the presentapplication.

In FIG. 2, the first blockchain node includes the plurality of servers,and each server can register with the registration center when beingonline (“online” mentioned here means that the server starts to normallyperform service processing), in other words, notify the registrationcenter that the server is currently in an available state and canreceive the service request sent by the client. After determining thatthe server is online, the registration center can obtain an address ofthe server, and then push the address to the client, so that the clientstores the address after receiving the address.

In this implementation of the present application, the registrationcenter can proactively obtain the address of the server from the server,or the server can provide the address for the registration center. Forexample, after the server registers with the registration center, theregistration center can return a Registration Successful message to theserver. The server can proactively send the address of the server to theregistration center after receiving the message, so that theregistration center manages the address.

Besides that the registration center can proactively push the obtainedaddress to the client, the client can also proactively obtain addressesmanaged by the registration center. For example, in addition to sendingthe service request to the first blockchain node, the client can furthersend an address acquisition query message to the registration center.After receiving the query message, the registration center can send anaddress of a currently available server (namely, a server currentlyregistering with the registration center) in the first blockchain nodeto the client, so that after receiving addresses sent by theregistration center, the client selects an address from the addresses,and sends the service request to a server corresponding to the selectedaddress. Certainly, the client can also obtain the addresses of theservers included in the first blockchain node from the registrationcenter by using other methods. Details are omitted here.

It is worthwhile to note that in practice, a server in the firstblockchain node is possibly offline (in other words, the server cannotperform service processing) because of a running fault, a programrestart, etc. If the registration center sends an address of the offlineserver to the client, and the client exactly selects the address of theoffline server during server selection, the client possibly cannot sendthe service request to the first blockchain node, and the firstblockchain node cannot process the service request.

To avoid the problems, in this implementation of the presentapplication, the registration center can regularly send a heartbeatdetection message to each server that has registered with theregistration center. The server can return a response message to theregistration center based on the received heartbeat detection messagewhen running normally online. After receiving the response message, theregistration center can determine that the server is normally runningonline, and continues to manage an address of the server.

After sending the heartbeat detection message to the server, ifdetecting that no response message returned by the server based on theheartbeat detection message is received after a specified time elapses,the registration center can determine that the server is possiblyoffline currently because of a running fault, a program restart, etc.,and does not push the address of the server to the client. In addition,if the registration center has pushed the address of the server to theclient, the registration center can send a notification that the serveris offline to the client, so that the client locally deletes the addressof the server based on the notification.

After deleting the address of the offline server, the client does notsend the service request to the server. When the server is back online,the client re-obtains the address of the server from the registrationcenter, and sends the service request to the server by using theaddress.

It is worthwhile to note that FIG. 2 is merely described by using anexample that the client obtains the addresses included in the firstblockchain node from the registration center. In FIG. 2, because thefirst blockchain node can receive the service request sent by the clientfrom the client, the servers in the first blockchain node need toregister with the registration center, so that the registration centercan push the addresses of the servers in the first blockchain node tothe client, and the client can send the service request to the serversin the first blockchain node by using the obtained addresses.

However, in practice, second blockchain nodes in the consensus networkcan also receive the service request sent by the client, and process theservice request. Therefore, in this implementation of the presentapplication, servers included in each second blockchain node in theconsensus network can also register with the registration center, sothat the registration center can push addresses of the servers includedin the second blockchain node to the client. As such, the client canalso send the service request to the servers in the second blockchainnode by using the obtained addresses.

S102. Store, by using the server, the service request in a servicememory included in the first blockchain node, and send the servicerequest to each second blockchain node in a consensus network, so thateach second blockchain node stores the service request in a servicememory included in the second blockchain node after receiving theservice request.

After receiving the service request sent by the client, the serverincluded in the first blockchain node can store the service request inthe service memory included in the first blockchain node. In addition,the server can send the service request sent by the client to eachsecond blockchain node in the consensus network, so that the secondblockchain node stores the service request in the service memoryincluded in the second blockchain node after receiving the servicerequest.

The server in the first blockchain node can first perform validverification on the service request after receiving the service request.The valid verification can be valid verification by using an asymmetricsignature such as an RSA algorithm, or can be verification in otherforms. When determining that the service request succeeds in the validverification, the server can store the service request in the servicememory included in the first blockchain node, and send the servicerequest to each second blockchain node in the consensus network. Whendetermining that the service request does not succeed in the validverification, the server does not store the service request, but canreturn a message indicating that the service request fails to beprocessed to the client, so that the user performs certain operationsafter reading the message by using the client. For example, the user canre-edit the service request in the client and send an edited servicerequest to the server included in the first blockchain node by using theclient after reading the message.

In this implementation of the present application, each blockchain nodein the consensus network can include a plurality of servers. Therefore,when sending the service request to the second blockchain node, theserver in the first blockchain node also needs to obtain addresses ofthe servers in the second blockchain node, and then sends the servicerequest to the servers included in the second blockchain node by usingthe obtained addresses.

Therefore, in this implementation of the present application, theregistration center also needs to manage the addresses of the servers inthe second blockchain node, and sends the addresses of the servers inthe second blockchain node to each server in the first blockchain node,which is shown in FIG. 3.

FIG. 3 is a schematic diagram of pushing an address of each server in asecond blockchain node to each server in a first blockchain node by aregistration center, according to an implementation of the presentapplication.

In FIG. 3, the servers in the second blockchain node can also registerwith the registration center after being online, so that theregistration center obtains the addresses of the servers in the secondblockchain node. The registration center can proactively obtain theaddresses from the servers in the second blockchain node, or the serversin the second blockchain node can proactively send their addresses tothe registration center. A specific method is the same as the previouslydescribed method in step S101 of obtaining the addresses of the serversin the first blockchain node by the registration center, and details areomitted here.

After obtaining the addresses of the servers in the second blockchainnode by using the registration center, each server in the firstblockchain node can store the obtained addresses. When sending theservice request to the second blockchain node, the server in the firstblockchain node can select an address from the stored addresses includedin the second blockchain node, and then send the service request to aserver corresponding to the address, so that the server corresponding tothe address stores the service request in the service memorycorresponding to the second blockchain node after receiving the servicerequest.

The server in the second blockchain node can also perform validverification on the service request after receiving the service request.The server can store the service request in the service memory includedin the second blockchain node when determining that the service requestsucceeds in the valid verification. The server does not store theservice request when determining that the service request does notsucceed in the valid verification.

It is worthwhile to note that the servers included in the secondblockchain node are also possibly offline as mentioned in step S101.Therefore, after obtaining the addresses of the servers in the secondblockchain node, the registration center can regularly send a heartbeatdetection message to the servers corresponding to these addresses. Whenreceiving a response message returned by a server based on the heartbeatdetection message after a specified time elapses (or within a specifiedtime), the registration center can determine that the server is still inan online state, and continues to manage an address of the server. Whennot receiving the response message returned by the server based on theheartbeat detection message after the specified time elapses, theregistration center can determine that the server is possibly offlinebecause of a running fault, network instability, etc., and does notcontinue to manage the address of the server until the server is backonline.

In addition, when determining, by using the previously described method,that a certain server in the second blockchain node is offline, theregistration center can send a notification that the server is offlineto the servers in the first blockchain node and the client, so that theservers in the first blockchain node and the client delete an address ofthe server after receiving the notification, and subsequently do notsend the service request to the server corresponding to the addressuntil the server is back online. After re-obtaining the address of theserver from the registration center, the servers in the first blockchainnode and the client can send the service request to the servercorresponding to the address by using the obtained address.

FIG. 3 merely shows a case that servers included in one secondblockchain node register with a registration center. In practice, thereare a plurality of second blockchain nodes in a consensus network.Therefore, servers in each second blockchain node in the consensusnetwork can register with the registration center after being online, sothat the registration center obtains addresses of the servers in thesecond blockchain node, and pushes the obtained addresses to the serversin the first blockchain node. In other words, each server in the firstblockchain node stores the addresses of the servers included in eachsecond blockchain node in the consensus network.

It is worthwhile to note that in practice, the entire consensus networkincludes a plurality of blockchain nodes. The first blockchain nodementioned in this implementation of the present application is ablockchain node that receives the service request sent by the client,and other blockchain nodes than the first blockchain node can bereferred to as second blockchain nodes in this implementation of thepresent application. The first blockchain node and the second blockchainnode are relative terms. To be specific, a blockchain node that receivesthe service request from the client can be referred to as the firstblockchain node, and a blockchain node that receives the service requestsent by the first blockchain node can be referred to as the secondblockchain node. Because the blockchain nodes in the consensus networkcan all receive the service request sent by the client, the blockchainnodes can be essentially first blockchain nodes, or can be secondblockchain nodes. Division between the first blockchain node and thesecond blockchain node depends on where the service request is received.

Certainly, in a consensus check process, division between the firstblockchain node and the second blockchain node can also be determinedbased on which node initiates the consensus check. To be specific, aconsensus check initiator that sends a preprocessing block that includesat least one service request to the consensus network can be the firstblockchain node, and a blockchain node that receives the preprocessingblock can be referred to as the second blockchain node.

S103. Select a server from the plurality of servers included in thefirst blockchain node, and obtain at least one service request from aservice memory included in the first blockchain node by using theselected server, in a service consensus phase.

In this implementation of the present application, the server in thefirst blockchain node needs to perform service consensus on the servicerequest in the service memory included in the first blockchain node.Therefore, in the service consensus phase, the server in the firstblockchain node can obtain the at least one service request from theservice memory included in the first blockchain node, and subsequentlypackage the obtained service request into a preprocessing block and sendthe preprocessing block to each second blockchain node in the consensusnetwork for service consensus.

In this implementation of the present application, in addition to theplurality of servers and the service memory, the first blockchain nodefurther includes a scheduled task trigger, and the scheduled tasktrigger is used to periodically initiate service consensus to eachblockchain node in the consensus network by using the server in thefirst blockchain node. However, because the first blockchain nodeincludes the plurality of servers, the scheduled task trigger can selecta server from the plurality of servers included in the first blockchainnode in the service consensus phase, and then the server obtains the atleast one service request from the service memory included in the firstblockchain node.

In this implementation of the present application, the scheduled tasktrigger can be a hardware device, or can be a form of software. For aform of software, the scheduled task trigger can be set in a certainserver in the first blockchain node. When running in the server, thescheduled task trigger can select a server from the servers included inthe first blockchain node in the service consensus phase, and send anotification to the selected server by using a server that the scheduledtask trigger is located in, so that the selected server obtains the atleast one request from the service memory included in the firstblockchain node after receiving the notification.

In the process of obtaining each service request from the service memory(namely, the service memory included in the first blockchain node), theserver can obtain each service request based on the time sequence thateach service request stores in the service memory, or can obtain eachservice request based on the service type of each service request, orcan obtain each service request based on the service level of eachservice request. There are many acquisition methods, and details areomitted here.

S104: Package the at least one service request into a preprocessingblock by using the selected server, and send the preprocessing block toeach second blockchain node in the consensus network by using theselected server, so that each second blockchain node performs serviceconsensus on the preprocessing block.

After obtaining the at least one service request from the service memoryincluded in the first blockchain node, the server in the firstblockchain node can process the obtained service requests, and packagethe service requests into a preprocessing block. The server can sort theobtained service requests based on a predetermined sorting rule toobtain a sorting result of the service requests, and determine, by usinga predetermined identifier determining rule and the sorting result, anidentifier to be verified that uniquely corresponds to the servicerequests. Then, the server can package the obtained service requests,the sorting result of the service requests, and the determinedidentifier to be verified into one preprocessing block, and then sendthe preprocessing block to the servers included in the second blockchainnode.

A specific method of determining the identifier to be verified by theserver can be shown in FIG. 4.

FIG. 4 is a schematic diagram of determining an identifier to beverified by a server, according to an implementation of the presentapplication.

In FIG. 4, a server in the first blockchain node (namely, a serverdetermined by using the scheduled task trigger included in the firstblockchain node) obtains four service requests shown in FIG. 4 from theservice memory included in the first blockchain node. The server cansort the four service requests based on a predetermined sorting rule, toobtain a sorting result shown in FIG. 4. Then, the server can separatelydetermine child identifiers Hash1 to Hash4 corresponding to the fourservice requests based on a predetermined identifier determining rule: ahash algorithm, and place the determined four child identifiers in leafnodes of a Merkle tree from left to right based on an obtained sortingresult, to determine a value Hash7 at the root node of the Merkle tree.The server can determine the determined the value Hash7 at the root nodeof the Merkle tree as an identifier to be verified that uniquelycorresponds to the four service requests, and then package thedetermined identifier to be verified, the sorting result, and the fourservice requests into one preprocessing block.

It is worthwhile to note that the method of determining the identifierto be verified shown in FIG. 4 is not unique. For example, in additionto determining the identifier to be verified that uniquely correspondsto the service requests by using the hash algorithm as the predeterminedidentifier determining rule, the server in the first blockchain node canfurther determine the identifier to be verified that uniquelycorresponds to the service requests by using an algorithm such as amessage digest algorithm 5 (MD5), provided that the determinedidentifier to be verified uniquely corresponds to the service requests.In addition to the form shown in FIG. 4, the Merkle tree can furtherhave other forms. Details are omitted here.

Certainly, in this implementation of the present application, inaddition to the Merkle tree, the server in the first blockchain node canfurther determine the identifier to be verified that uniquelycorresponds to the service requests by using other methods. For example,after determining child identifiers corresponding to the servicerequests, the server can sort the determined child identifiers based ona certain sequence, encrypt the sorted result again, and use theencrypted result as the identifier to be verified that uniquelycorresponds to the service requests. Alternatively, after determiningchild identifiers corresponding to the service requests, the server cangenerate a universally unique ID by using a snowflake algorithm, and usethe ID as the identifier to be verified that uniquely corresponds to theservice requests. Alternatively, the server can determine a universallyunique identifier (UUID) of the determined child identifierscorresponding to the service requests, and use the UUID as theidentifier to be verified that uniquely corresponds to the servicerequests. Certainly, there are still other determining methods, anddetails are omitted here, provided that it is ensured that thedetermined identifier to be verified can uniquely correspond to theservice requests.

After determining the preprocessing block, the server in the firstblockchain node (namely, the server selected by using the scheduled tasktrigger in the first blockchain node in the service consensus phase) cansend the preprocessing block to each second blockchain node in theconsensus network. However, each second blockchain node in the consensusnetwork includes a plurality of servers. Therefore, when sending thepreprocessing block, the server in the first blockchain node needs todetermine a server in each second blockchain node that the preprocessingblock is sent to.

In this implementation of the present application, each server in thefirst blockchain node can obtain the addresses of the servers includedin each second blockchain node in the consensus network from theregistration center. Therefore, when the server in the first blockchainnode needs to send the preprocessing block to a certain secondblockchain node in the consensus network, the server can select anaddress from the stored addresses of the servers in the secondblockchain node (the stored addresses are addresses of servers in thesecond blockchain node that are in an online state), and send thepreprocessing block to a server corresponding to the address, so thatthe server corresponding to the address performs consensus check on thepreprocessing block after receiving the preprocessing block.

There are a plurality of second blockchain nodes in the consensusnetwork. Therefore, when sending the preprocessing block to each secondblockchain node, the server in the first blockchain node can separatelydetermine, from the stored addresses by using the previously describedmethod, servers in each second blockchain node that receive thepreprocessing block, and then separately send the preprocessing block tothe servers in each second blockchain node by using the determinedaddresses.

For the second blockchain node, after receiving the preprocessing blocksent by the server in the first blockchain node, the server included inthe second blockchain node can parse the preprocessing block, todetermine service requests included in the preprocessing block, asorting result of the service requests, and an identifier to beverified. Then, the server in the second blockchain node can findservice requests that match the service requests included in thepreprocessing block from the service memory included in the secondblockchain node, and determine, by using a predetermined identifierdetermining rule and the determined sorting result of the servicerequests, an identifier that uniquely corresponds to the servicerequests found from the service memory included in the second blockchainnode. The predetermined identifier determining rule mentioned here isthe same as the identifier determining rule used by the server in thefirst blockchain node.

The server in the second blockchain node can compare the determinedidentifier with the identifier to be verified that is included in thepreprocessing block after determining the identifier, and can determinethat the preprocessing block succeeds in local consensus check (in otherwords, which is performed by the server in the second blockchain node)when determining that the two are consistent, and then store a checkresult in the service memory included in the second blockchain node, andsend the check result to other blockchain nodes in the consensus network(the other blockchain nodes mentioned here includes each secondblockchain node and the first blockchain node).

The method of sending the check result by the server in the secondblockchain node is the same as the method of sending the service requestor the preprocessing block to each second blockchain node in theconsensus network by the server in the first blockchain node. To bespecific, when the server in the second blockchain node needs to sendthe check result to a certain blockchain node in the consensus network(which can be the second blockchain node, or can be the first blockchainnode), the server can select an address from the locally storedaddresses of servers in the blockchain node, and send the check resultto a server corresponding to the address. After receiving the checkresult, the server corresponding to the address can store the checkresult in a service memory included in the blockchain node that theserver belongs to.

When the server in the second blockchain node sends the check result toeach blockchain node in the consensus network, other servers in thesecond blockchain node or the server can also receive check resultsabout the preprocessing block that are sent by other blockchain nodes inthe consensus network, and store all the received check results in theservice memory included in the second blockchain node. Then, the server(the server can be a server that receives the preprocessing block) inthe second blockchain node can determine, from the service memoryincluded in the second blockchain node, a check result (including acheck result obtained by the server) about the preprocessing block thatis obtained by each blockchain node in the consensus network, anddetermine a comprehensive check result about the preprocessing blockthat is obtained by each blockchain node in the consensus network. Then,the server can send the determined comprehensive check result to eachblockchain node in the consensus network by using a method that is thesame as that of sending the check result, and store the comprehensivecheck result in the service memory included in the second blockchainnode.

After the server in the second blockchain node sends the comprehensivecheck result, other servers in the second blockchain node or the server(namely, a server that sends the comprehensive check result) can alsoreceive a comprehensive check result about the preprocessing block thatis sent by each blockchain node (including each second blockchain nodeand the first blockchain node) in the consensus network, and store thecomprehensive check in the service memory included in the secondblockchain node.

The server (namely, the server that sends the comprehensive checkresult) in the second blockchain node can obtain a comprehensive checkresult sent by other blockchain nodes in the consensus network from theservice memory included in the second blockchain node, determine, byusing the received comprehensive check result and a comprehensive checkresult determined by the server, whether the preprocessing blocksucceeds in the service consensus in the consensus network, and writeeach service request included in the preprocessing block into ablockchain that the second blockchain node is stored in if determiningthat each service request included in the preprocessing block succeedsin the service consensus in the consensus network based on thecomprehensive check results (including the comprehensive check resultdetermined by the server) stored in the service memory, or otherwise donot write each service request into the blockchain. The server in thesecond blockchain node can write complete content of each servicerequest into the blockchain, or can write only an information digest ofeach service request into the blockchain.

The previously described service consensus process is relativelycomplex. For ease of understanding, the following lists a simple exampleto clearly describe the process of performing service consensus on thepreprocessing block by the server in the second blockchain node, whichis shown in FIG. 5.

FIG. 5 is a schematic diagram illustrating a process of performingservice consensus on a preprocessing block by a server in a secondblockchain node, according to an implementation of the presentapplication.

Assume that there are three blockchain nodes in a consensus network: afirst blockchain node, a second blockchain node A, and a secondblockchain node B. Each server in the three blockchain nodesrespectively stores addresses of servers included in the other twoblockchain nodes. A server #3 in the first blockchain node obtains atleast one service request from a service memory included in the firstblockchain node, packages the at least one service request into apreprocessing block, and sends the preprocessing block to the other twoblockchain nodes. The server #3 determines to separately send thepreprocessing block to a server A1 and a server B1 by using addresses ofservers included in the other two blockchain nodes that are stored inthe server #3.

After receiving the preprocessing block, the server A1 and the server B1can perform consensus check on the preprocessing block, and respectivelystore obtained check results for the preprocessing block in servicememories included in blockchain nodes that the server A1 and the serverB1 belong to. In addition, the server A1 and the server B1 canrespectively send the determined check results to the other twoblockchain nodes in the consensus network. The server A1 determines tosend a check result obtained by the server A1 to a server #2 in thefirst blockchain node and a server B2 in the second blockchain node Bbased on addresses of servers in the other two blockchain nodes that arestored in the server A1, and the server B1 determines to send a checkresult obtained by the server B1 to the server #3 in the firstblockchain node and a server A3 in the second blockchain node A.

After separately receiving the check results sent by the servers in theother two blockchain nodes, servers in the three blockchain nodes in theconsensus network can store the received check results in the servicememories included in the blockchain nodes. The server A1 (namely, aserver that receives the preprocessing block) can obtain check results(including a check result obtained by the server A1) from a servicememory included in the second blockchain node A, and obtain acomprehensive check result of the blockchain nodes in the consensusnetwork for the preprocessing block based on these check results. Theserver A1 can store the obtained comprehensive check result in theservice memory included in the second blockchain node A, and send thecomprehensive check result to the other two blockchain nodes. Thesending method is the same as the method of sending the check result,and details are omitted here. The server #3 (namely, a server that sendsa service consensus) and the server B1 (a server that receives thepreprocessing block) can also determine a comprehensive check result forthe preprocessing block by using such method, and send the obtainedcomprehensive check result to the other two blockchain nodes in theconsensus network.

After receiving the check results sent by the other two blockchainnodes, the servers in the blockchain nodes in the consensus network canstore the received check results in the service memories included in theblockchain nodes.

The server A1 can obtain comprehensive check results (including acomprehensive check result obtained by the server A1) for thepreprocessing block, which are sent by the blockchain nodes, from theservice memory included in the second blockchain node A. Then, theserver A1 can determine whether the preprocessing block succeeds in theservice consensus in the consensus network based on the comprehensivecheck results. If yes, the server A1 writes each service requestincluded in the preprocessing block into a blockchain of the secondblockchain node A, and if no, the server A1 does not write each servicerequest into the blockchain. Likewise, the server #3 and the server B1can also obtain, by using such method, comprehensive check results fromthe service memories included in the blockchain nodes that the server #3and the server B1 belong to, and determine, based on the obtainedcomprehensive check results, whether to write each service requestincluded in the preprocessing block into the blockchain nodes of theserver #3 and the server B1.

It can be learned from the previously described method that eachblockchain node in the consensus network includes a plurality ofservers. Therefore, as long as one of servers in each blockchain node isin an online state, in other words, is available, the blockchain node isan available blockchain node in the consensus network, which greatlyimproves stability of the blockchain node in the consensus network. Inaddition, each blockchain node includes a plurality of servers, andfunctions and statuses of the servers are the same for the blockchainnode. In other words, compared with the existing technology, equivalentservers are added to the blockchain node. This greatly improves theperformance of the blockchain node, and thus the service processingefficiency of the blockchain node is greatly improved.

It is worthwhile to note that in a service consensus process, eachblockchain node in the consensus network can determine a check resultobtained by the blockchain node for the preprocessing block, send theobtained check result to other blockchain nodes in the consensusnetwork, and store the check result in a service memory corresponding tothe blockchain node. The blockchain node can perform consensus check onthe preprocessing block by using a first server included in theblockchain node, and the first server can be a specified server in theblockchain node, or can be a server selected from servers included inthe blockchain node.

In addition, the blockchain node also receives a check result sent byother blockchain nodes in the consensus network for the preprocessingblock. The blockchain node can receive, by using a server included inthe blockchain node, the check result sent by the other blockchainnodes, and stores the received check result in the service memorycorresponding to the blockchain node. Here, a server that receives thecheck result sent by the other blockchain nodes can be referred to as asecond server. The second server can be any server in the blockchainnode, and certainly, can be the previously described first server. Whichsecond server to receive the check result sent by the other blockchainnodes depends on the second server that is selected, by a serverincluded in the other blockchain nodes, to receive the check result sentby the other blockchains.

In step S101, in addition to randomly selecting an address from thestored addresses of the servers in the first blockchain node, the clientcan also select an address based on a load balancing status. Therefore,when pushing the addresses of the servers in the first blockchain nodeto the client, the registration center can jointly push load statuses ofthe servers to the client, so that the client selects an address of alightly loaded server from the addresses by using a predetermined loadbalancing algorithm, and sends the service request to the servercorresponding to the address.

Likewise, when sending the service request to each second blockchainnode in the consensus network, the server in the first blockchain nodecan also select a server from the stored addresses based on loadbalancing method. Certainly, the server in the first blockchain node canalso send the preprocessing block based on load balancing method, andeach blockchain node in the consensus network can also send the checkresult and the comprehensive check result based on load balancingmethod. A specific process is the same as the method of sending theservice request to the first blockchain node by the client based on loadbalancing method, and details are omitted here.

In this implementation of the present application, in addition toselecting a server that initiates service consensus by using thescheduled task trigger, consensus periods can be further respectivelyset in the servers in the blockchain node (including the firstblockchain node and the second blockchain node), and different servershave different consensus periods. When detecting that a current timereaches a consensus period of the server, the server can obtain at leastone service request from a service memory in the blockchain node thatthe server belongs to.

In this implementation of the present application, the server in theblockchain node (including the first blockchain node and the secondblockchain node) can also forward the service request to other serversin the blockchain node after receiving the service request, and theother servers store the service request in a service memory included inthe blockchain node. After receiving the preprocessing block sent by thefirst blockchain node, the server in each second blockchain node in theconsensus network can also forward the preprocessing block to otherservers in the second blockchain node for consensus check, and store theobtained check result in the service memory included in the secondblockchain node.

The service consensus method according to the implementations of thepresent application is described above. Based on the same idea, animplementation of the present application further provides the followingservice processing devicees and service consensus devicees, which areshown in FIG. 6 to FIG. 12.

FIG. 6 is a schematic structural diagram illustrating a serviceprocessing device, according to an implementation of the presentapplication, specifically including the following: a receiving module601, configured to receive a service request sent by a client; a storagemodule 602, configured to store the service request in a service memorycorresponding to the device; and a sending module 603, configured tosend the service request to each second blockchain node in a consensusnetwork, so that each second blockchain node stores the service requestin a service memory included in the second blockchain node afterreceiving the service request, where the second blockchain node includesa plurality of servers and at least one service memory.

The device further includes the following: a registration module 604,configured to send an address of the device to a registration centerwhen it is determined that the device is online, so that theregistration center sends the address to the client and each secondblockchain node in the consensus network.

The device further includes the following: an acquisition module 605,configured to obtain addresses of the plurality of servers included ineach second blockchain node from a registration center.

The sending module 603 is specifically configured to select an addressfrom the obtained addresses of the plurality of servers included in eachsecond blockchain node; and send the service request to a servercorresponding to the selected address.

The storage module 602 is specifically configured to perform validverification on the service request; and store the service request inthe service memory when it is determined that the service requestsucceeds in the valid verification.

The storage module 602 is further configured to skip storing the servicerequest when it is determined that the service request does not succeedin the valid verification.

A blockchain node includes a plurality of devicees.

FIG. 7 is a schematic structural diagram illustrating a serviceprocessing device, according to an implementation of the presentapplication, specifically including the following: a request receivingmodule 701, configured to receive a service request sent by a firstblockchain node, where the first blockchain node includes a plurality ofservers and at least one service memory; and a request storage module702, configured to store the service request in a service memorycorresponding to the device.

The device further includes the following: a registration module 703,configured to send an address of the device to a registration centerwhen it is determined that the device is online, so that theregistration center sends the address to the first blockchain node, aclient, and other second blockchain nodes in a consensus network.

The request storage module 702 is specifically configured to performvalid verification on the service request; and store the service requestin the service memory when it is determined that the service requestsucceeds in the valid verification.

The request storage module 702 is further configured to skip storing theservice request when it is determined that the service request does notsucceed in the valid verification.

FIG. 8 is a schematic structural diagram illustrating a serviceprocessing device, according to an implementation of the presentapplication, specifically including the following: an informationreceiving module 801, configured to receive service information enteredby a user; a request generation module 802, configured to generate acorresponding service request based on the service information; and asending module 803, configured to send the service request to a serverincluded in a first blockchain node, so that the first blockchain nodestores the received service request in a service memory included in thefirst blockchain node; and send the service request to each secondblockchain node in a consensus network, where the first blockchain nodeincludes a plurality of servers and at least one service memory, and thesecond blockchain node includes a plurality of servers and at least oneservice memory.

The sending module 803 is specifically configured to obtain addresses ofthe plurality of servers included in the first blockchain node from aregistration center; and select an address from the obtained addressesof the plurality of servers included in the first blockchain node, andsend the service request to a server corresponding to the selectedaddress.

The device further includes the following: a deletion module 804,configured to delete an address of a certain server when an offlinenotification sent by the registration center for the server is received.

FIG. 9 is a schematic structural diagram illustrating a serviceconsensus device, according to an implementation of the presentapplication, specifically including the following: a request acquisitionmodule 901, configured to obtain at least one service request from aservice memory corresponding to the device; and a sending module 902,configured to package the at least one service request into apreprocessing block, and send the preprocessing block to each secondblockchain node in a consensus network, so that each second blockchainnode performs service consensus on the preprocessing block, where thesecond blockchain node includes a plurality of servers and at least oneservice memory.

The device further includes the following: an address acquisition module903, configured to obtain addresses of the plurality of servers includedin each second blockchain node from a registration center.

The sending module 902 is specifically configured to select an addressfrom the obtained addresses of the plurality of servers included in eachsecond blockchain node; and send the preprocessing block to a servercorresponding to the selected address, so that the server correspondingto the selected address performs service consensus on the receivedpreprocessing block.

FIG. 10 is a schematic structural diagram illustrating a serviceconsensus device, according to an implementation of the presentapplication, specifically including the following: a selection module1001, configured to select a server from a plurality of servers includedin a first blockchain node, where the first blockchain node includes theplurality of servers and at least one service memory.

The selection module 1001 is specifically configured to detect whether acurrent moment satisfies a task trigger condition; and select the serverfrom the plurality of servers included in the first blockchain node whendetecting that the task trigger condition is satisfied.

FIG. 11 is a schematic structural diagram illustrating a serviceconsensus device, according to an implementation of the presentapplication, specifically including the following: an acquisition module1101, configured to obtain a preprocessing block; and a consensus module1102, configured to perform service consensus on the preprocessing blockbased on each service request stored in a service memory correspondingto the device.

The consensus module 1102 is specifically configured to performconsensus check on the preprocessing block, to obtain a check result;receive each check result sent by other blockchain nodes in a consensusnetwork, and store each received check result in the service memorycorresponding to the device; and obtain each check result from theservice memory, and perform service consensus on the preprocessing blockby using each obtained check result.

FIG. 12 is a schematic structural diagram illustrating a serviceconsensus device, according to an implementation of the presentapplication, specifically including the following: an acquisition module1201, configured to obtain addresses of a plurality of servers includedin each blockchain node in a consensus network, where each blockchainnode includes the plurality of servers and at least one service memory;and a sending module 1202, configured to send the obtained addresses ofthe plurality of servers included in the blockchain node to otherblockchain nodes in the consensus network and a client for storage.

The device further includes the following: a notification module 1203,configured to send a heartbeat detection message to the plurality ofservers included in each blockchain node in the consensus network basedon the obtained addresses of the plurality of servers included in theblockchain node; and when no response message returned by each serverincluded in the blockchain node based on the heartbeat detection messageis received after a specified time elapses, determine that the server isoffline, and instruct the client and the other blockchain nodes in theconsensus network to delete the stored address of the server.

The implementations of the present application provide a serviceprocessing and consensus method and device. In the method, a firstblockchain node includes a plurality of servers. The first blockchainnode can receive a service request sent by a client and store theservice request by using the plurality of included servers, obtain atleast one service request from a service memory included in the firstblockchain node by using a server in the plurality of servers, to obtaina preprocessing block, and send the preprocessing block to each secondblockchain node in a consensus network by using the server, to performservice consensus on the preprocessing block by using each secondblockchain node. It can be ensured that the first blockchain node isavailable, provided that one server in the plurality of servers includedin the first blockchain node is available. Therefore, stability of thefirst blockchain node in the consensus network is improved. In addition,each server included in the first blockchain node can receive theservice request sent by a user by using the client, and each server caninitiate service consensus to each second blockchain node in theconsensus network. Therefore, service processing efficiency of ablockchain service is greatly improved.

In the 1990s, improvement of a technology can be clearly distinguishedbetween hardware improvement (for example, improvement on a circuitstructure such as a diode, a transistor, or a switch) and softwareimprovement (improvement on a method procedure). However, with thedevelopment of technologies, improvement of many method procedures canbe considered as direct improvement of a hardware circuit structure.Designers almost all program an improved method procedure to a hardwarecircuit, to obtain a corresponding hardware circuit structure.Therefore, it cannot be said that improvement of a method procedurecannot be implemented by using a hardware entity module. For example, aprogrammable logic device (PLD) (for example, a field programmable gatearray (FPGA)) is such an integrated circuit. A logical function of theprogrammable logic device is determined by component programmingexecuted by a user. The designers perform voluntary programming to“integrate” a digital system into a single PLD without requiring a chipmanufacturer to design and produce a dedicated integrated circuit chip.In addition, instead of manually producing an integrated circuit chip,the programming is mostly implemented by “logic compiler” software,which is similar to a software compiler used during program development.Original code before compiling is also written in a specific programminglanguage, which is referred to as a hardware description language (HDL),and there is more than one type of HDL, such as ABEL (Advanced BooleanExpression Language), AHDL (Altera Hardware Description Language),Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL(Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, andRHDL (Ruby Hardware Description Language), etc. Currently, VHDL(Very-High-Speed Integrated Circuit Hardware Description Language) andVerilog are most commonly used. A person skilled in the art should alsounderstand that a method procedure only needs to be logicallyprogrammed, and programmed to the integrated circuit by using theprevious hardware description languages so that a hardware circuit thatimplements the logical method procedure can be easily obtained.

A controller can be implemented by using any appropriate method. Forexample, the controller can be a microprocessor or a processor, or acomputer-readable medium, a logic gate, a switch, anapplication-specific integrated circuit (ASIC), a programmable logiccontroller, or an embedded microprocessor that stores computer readableprogram code (such as software or firmware) that can be executed by themicroprocessor or the processor. Examples of the controller include butare not limited to the following microprocessors: ARC 625D, AtmelAT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320. The memorycontroller can also be implemented as a part of the control logic of thememory. A person skilled in the art also knows that a controller can beimplemented by using pure computer-readable program code, and the stepsin the method can be logically programmed to enable the controller tofurther implement same functions in forms of a logic gate, a switch, anapplication-specific integrated circuit, a programmable logiccontroller, an embedded microcontroller, etc. Therefore, the controllercan be considered as a hardware component, and a device that is includedin the controller and that is configured to implement various functionscan also be considered as a structure in the hardware component.Alternatively, a device configured to implement various functions can beconsidered as both a software module for implementing the method and astructure in the hardware component.

The system, device, module, or unit described in the describedimplementations can be implemented by a computer chip or an entity, orimplemented by a product with a certain function. A typicalimplementation device is a computer. The computer can be, for example, apersonal computer, a laptop computer, a cellular phone, a camera phone,a smartphone, a personal digital assistant, a media player, a navigationdevice, an email device, a game console, a tablet computer, or awearable device, or a combination of any of these devices.

For ease of description, the described device is described by dividingfunctions into various units. Certainly, when the present application isimplemented, the functions of the units can be implemented in one ormore pieces of software and/or hardware.

A person skilled in the art should understand that the implementationsof the present disclosure can be provided as a method, a system, or acomputer program product. Therefore, the present disclosure can use aform of hardware only implementations, software only implementations, orimplementations with a combination of software and hardware. Inaddition, the present disclosure can use a form of a computer programproduct that is implemented on one or more computer-usable storage media(including but not limited to a disk memory, a CD-ROM, and an opticalmemory) that include computer-usable program code.

The present disclosure is described with reference to the flowchartsand/or block diagrams of the method, the device (system), and thecomputer program product according to the implementations of the presentdisclosure. It should be understood that computer program instructionscan be used to implement each process and/or each block in theflowcharts and/or the block diagrams and a combination of a processand/or a block in the flowcharts and/or the block diagrams. Thesecomputer program instructions can be provided for a general-purposecomputer, a dedicated computer, an embedded processor, or a processor ofany other programmable data processing device to generate a machine sothat the instructions executed by a computer or a processor of any otherprogrammable data processing device generate a device for implementing aspecific function in one or more processes in the flowcharts or in oneor more blocks in the block diagrams.

These computer program instructions can be stored in a computer readablememory that can instruct the computer or any other programmable dataprocessing device to work in a specific method, so that the instructionsstored in the computer readable memory generate an artifact thatincludes an instruction device. The instruction device implements aspecific function in one or more processes in the flowcharts and/or inone or more blocks in the block diagrams.

These computer program instructions can be loaded to a computer or otherprogrammable data processing devices, so that a series of operations andsteps are performed on the computer or the other programmable devices,generating computer-implemented processing. Therefore, the instructionsexecuted on the computer or the other programmable devices provide stepsfor implementing a specific function in one or more processes in theflowcharts or in one or more blocks in the block diagrams.

In a typical configuration, the computing device includes one or moreprocessors (CPU), one or more input/output interfaces, one or morenetwork interfaces, and one or more memories.

The memory can include a non-persistent memory, a random access memory(RAM) and/or a nonvolatile memory in a computer readable medium, forexample, a read-only memory (ROM) or a flash memory (flash RAM).

The computer readable medium includes persistent, non-persistent,movable, and unmovable media that can implement information storage byusing any method or technology. Information can be a computer readableinstruction, a data structure, a program module, or other data. Acomputer storage medium includes but is not limited to a parameterrandom access memory (PRAM), a static random access memory (SRAM), adynamic random access memory (DRAM), a random access memory (RAM) ofother types, a read-only memory (ROM), an electrically erasableprogrammable read-only memory (EEPROM), a flash memory or other memorytechnologies, a compact disc read-only memory (CD-ROM), a digitalversatile disc (DVD) or other optical storages, a magnetic tape, amagnetic disk storage, other magnetic storage devices, or any othernon-transmission media that can be used to store information that can beaccessed by the computing device. Based on the definition in the presentspecification, the computer readable medium does not include transitorycomputer readable medium(transitory media), for example, a modulateddata signal and carrier.

It is worthwhile to further note that the term “include”, “contain”, ortheir any other variant is intended to cover a non-exclusive inclusion,so that a process, a method, merchandise, or a device that includes alist of elements not only includes those elements but also includesother elements which are not expressly listed, or further includeselements inherent to such process, method, merchandise, or device. Anelement preceded by “includes a . . . ” does not, without moreconstraints, preclude the existence of additional identical elements inthe process, method, merchandise, or device that includes the element.

A person skilled in the art should understand that the implementationsof the present application can be provided as a method, a system, or acomputer program product. Therefore, the present application can use aform of hardware only implementations, software only implementations, orimplementations with a combination of software and hardware. Inaddition, the present application can use a form of a computer programproduct that is implemented on one or more computer-usable storage media(including but not limited to a disk memory, a CD-ROM, and an opticalmemory) that include computer-usable program code.

The present application can be described in the general context ofcomputer executable instructions executed by a computer, for example, aprogram module. Generally, the program module includes a routine, aprogram, an object, a component, a data structure, etc. for executing aspecific task or implementing a specific abstract data type. The presentapplication can also be practiced in distributed computing environments.In the distributed computing environments, tasks are performed by remoteprocessing devices connected through a communications network. In adistributed computing environment, the program module can be located inboth local and remote computer storage media including storage devices.

The implementations in the present specification are all described in aprogressive way. For the same or similar parts of the implementations,refer to the implementations. Each implementation focuses on adifference from other implementations. Particularly, a systemimplementation is basically similar to a method implementation, andtherefore is described briefly. For related parts, refer to partialdescriptions of the method implementation.

The previous descriptions are merely implementations of the presentapplication, and are not intended to limit the present application. Aperson skilled in the art can make various modifications and changes tothe present application. Any modification, equivalent replacement,improvement, etc. made within the spirit and principle of the presentapplication shall fall within the scope of the claims of the presentapplication.

This specification describes techniques for improving the stability andservice processing efficiency of a blockchain node. For example, eachblockchain node can include a corresponding plurality of servers. Aregistration center can be configured to manage addresses of servers ineach blockchain node, and push the addresses of the servers to theclient. The client can randomly select an address from the addressespushed by the registration center, and send the service request to aserver corresponding to the address. The registration center can alsosend the addresses of the servers in a blockchain node to each server inanother blockchain node. The blockchain node can randomly select anaddress from the addresses of the other blockchain node, and send theservice request to the other blockchain node based on the address. Itcan be ensured that the blockchain node is available, provided that oneserver in the plurality of servers included in the blockchain node isavailable. Therefore, stability of the blockchain node in the consensusnetwork is greatly improved. In addition, each server included in theblockchain node can receive the service request sent by a client, andeach server can initiate service consensus in the consensus network.Therefore, service processing efficiency of a blockchain service isgreatly improved.

Embodiments and the operations described in this specification can beimplemented in digital electronic circuitry, or in computer software,firmware, or hardware, including the structures disclosed in thisspecification or in combinations of one or more of them. The operationscan be implemented as operations performed by a data processingapparatus on data stored on one or more computer-readable storagedevices or received from other sources. A data processing apparatus,computer, or computing device may encompass apparatus, devices, andmachines for processing data, including by way of example a programmableprocessor, a computer, a system on a chip, or multiple ones, orcombinations, of the foregoing. The apparatus can include specialpurpose logic circuitry, for example, a central processing unit (CPU), afield programmable gate array (FPGA) or an application-specificintegrated circuit (ASIC). The apparatus can also include code thatcreates an execution environment for the computer program in question,for example, code that constitutes processor firmware, a protocol stack,a database management system, an operating system (for example anoperating system or a combination of operating systems), across-platform runtime environment, a virtual machine, or a combinationof one or more of them. The apparatus and execution environment canrealize various different computing model infrastructures, such as webservices, distributed computing and grid computing infrastructures.

A computer program (also known, for example, as a program, software,software application, software module, software unit, script, or code)can be written in any form of programming language, including compiledor interpreted languages, declarative or procedural languages, and itcan be deployed in any form, including as a stand-alone program or as amodule, component, subroutine, object, or other unit suitable for use ina computing environment. A program can be stored in a portion of a filethat holds other programs or data (for example, one or more scriptsstored in a markup language document), in a single file dedicated to theprogram in question, or in multiple coordinated files (for example,files that store one or more modules, sub-programs, or portions ofcode). A computer program can be executed on one computer or on multiplecomputers that are located at one site or distributed across multiplesites and interconnected by a communication network.

Processors for execution of a computer program include, by way ofexample, both general- and special-purpose microprocessors, and any oneor more processors of any kind of digital computer. Generally, aprocessor will receive instructions and data from a read-only memory ora random-access memory or both. The essential elements of a computer area processor for performing actions in accordance with instructions andone or more memory devices for storing instructions and data. Generally,a computer will also include, or be operatively coupled to receive datafrom or transfer data to, or both, one or more mass storage devices forstoring data. A computer can be embedded in another device, for example,a mobile device, a personal digital assistant (PDA), a game console, aGlobal Positioning System (GPS) receiver, or a portable storage device.Devices suitable for storing computer program instructions and datainclude non-volatile memory, media and memory devices, including, by wayof example, semiconductor memory devices, magnetic disks, andmagneto-optical disks. The processor and the memory can be supplementedby, or incorporated in, special-purpose logic circuitry.

Mobile devices can include handsets, user equipment (UE), mobiletelephones (for example, smartphones), tablets, wearable devices (forexample, smart watches and smart eyeglasses), implanted devices withinthe human body (for example, biosensors, cochlear implants), or othertypes of mobile devices. The mobile devices can communicate wirelessly(for example, using radio frequency (RF) signals) to variouscommunication networks (described below). The mobile devices can includesensors for determining characteristics of the mobile device's currentenvironment. The sensors can include cameras, microphones, proximitysensors, GPS sensors, motion sensors, accelerometers, ambient lightsensors, moisture sensors, gyroscopes, compasses, barometers,fingerprint sensors, facial recognition systems, RF sensors (forexample, Wi-Fi and cellular radios), thermal sensors, or other types ofsensors. For example, the cameras can include a forward- or rear-facingcamera with movable or fixed lenses, a flash, an image sensor, and animage processor. The camera can be a megapixel camera capable ofcapturing details for facial and/or iris recognition. The camera alongwith a data processor and authentication information stored in memory oraccessed remotely can form a facial recognition system. The facialrecognition system or one-or-more sensors, for example, microphones,motion sensors, accelerometers, GPS sensors, or RF sensors, can be usedfor user authentication.

To provide for interaction with a user, embodiments can be implementedon a computer having a display device and an input device, for example,a liquid crystal display (LCD) or organic light-emitting diode(OLED)/virtual-reality (VR)/augmented-reality (AR) display fordisplaying information to the user and a touchscreen, keyboard, and apointing device by which the user can provide input to the computer.Other kinds of devices can be used to provide for interaction with auser as well; for example, feedback provided to the user can be any formof sensory feedback, for example, visual feedback, auditory feedback, ortactile feedback; and input from the user can be received in any form,including acoustic, speech, or tactile input. In addition, a computercan interact with a user by sending documents to and receiving documentsfrom a device that is used by the user; for example, by sending webpages to a web browser on a user's client device in response to requestsreceived from the web browser.

Embodiments can be implemented using computing devices interconnected byany form or medium of wireline or wireless digital data communication(or combination thereof), for example, a communication network. Examplesof interconnected devices are a client and a server generally remotefrom each other that typically interact through a communication network.A client, for example, a mobile device, can carry out transactionsitself, with a server, or through a server, for example, performing buy,sell, pay, give, send, or loan transactions, or authorizing the same.Such transactions may be in real time such that an action and a responseare temporally proximate; for example an individual perceives the actionand the response occurring substantially simultaneously, the timedifference for a response following the individual's action is less than1 millisecond (ms) or less than 1 second (s), or the response is withoutintentional delay taking into account processing limitations of thesystem.

Examples of communication networks include a local area network (LAN), aradio access network (RAN), a metropolitan area network (MAN), and awide area network (WAN). The communication network can include all or aportion of the Internet, another communication network, or a combinationof communication networks. Information can be transmitted on thecommunication network according to various protocols and standards,including Long Term Evolution (LTE), 5G, IEEE 802, Internet Protocol(IP), or other protocols or combinations of protocols. The communicationnetwork can transmit voice, video, biometric, or authentication data, orother information between the connected computing devices.

Features described as separate implementations may be implemented, incombination, in a single implementation, while features described as asingle implementation may be implemented in multiple implementations,separately, or in any suitable sub-combination. Operations described andclaimed in a particular order should not be understood as requiring thatthe particular order, nor that all illustrated operations must beperformed (some operations can be optional). As appropriate,multitasking or parallel-processing (or a combination of multitaskingand parallel-processing) can be performed.

What is claimed is:
 1. A computer-implemented method for serviceprocessing, the computer-implemented method comprising: sharing, from afirst server of a first blockchain node in a consensus network, nodeconfiguration information with a plurality of additional servers of thefirst blockchain node, wherein the node configuration informationcomprises a point-to-point routing table, an asymmetric public key, anasymmetric private key, and a node identity; receiving, by the firstserver of the first blockchain node, a service request sent by a client,wherein the consensus network further comprises a plurality ofadditional blockchain nodes, the first blockchain node and each node ofthe plurality of additional blockchain nodes of the consensus networkcomprising a corresponding plurality of servers; storing the servicerequest in at least one service memory of the first blockchain node;obtaining, by the first blockchain node and from a registration center,at least one address of at least one server of the correspondingplurality of servers for each node of the plurality of additionalblockchain nodes in the consensus network; and sending the servicerequest to each additional blockchain node in the consensus networkbased on the obtained at least one address, wherein each additionalblockchain node stores the service request in a corresponding at leastone service memory after receiving the service request.
 2. Thecomputer-implemented method of claim 1, comprising: registering thefirst server of the first blockchain node with the registration center;receiving a message from the registration center; and in response to themessage from the registration center, sending an address of the firstserver to the registration center.
 3. The computer-implemented method ofclaim 1, wherein sending the service request to each additionalblockchain node in the consensus network based on the obtained at leastone address comprises: selecting a first address from the obtained atleast one address of the corresponding plurality of servers of theplurality of additional blockchain nodes; and sending the servicerequest to the first address.
 4. The computer-implemented method ofclaim 3, wherein selecting the first address is based on at least one ofa random selection, a load balancing status, or a combination thereof.5. The computer-implemented method of claim 1, wherein storing theservice request in the at least one service memory of the firstblockchain node comprises: verifying the service request is valid; andstoring the service request in the at least one service memory of thefirst blockchain node in response to verifying the service request isvalid.
 6. The computer-implemented method of claim 1, comprising:selecting, by the first blockchain node, the first server of the firstblockchain node; obtaining, by the first server, at least one servicerequest from the at least one service memory of the first blockchainnode; packaging, by the first server, the at least one service requestinto a preprocessing block; and sending the preprocessing block to eachadditional blockchain node in the consensus network, wherein eachadditional blockchain node performs service consensus on thepreprocessing block.
 7. The computer-implemented method of claim 1,further comprising: receiving a heartbeat detection message by the firstserver of the first blockchain node from the registration center.
 8. Anon-transitory, computer-readable medium storing one or moreinstructions executable by a computer system to perform operationscomprising: sharing, from a first server of a first blockchain node in aconsensus network, node configuration information with a plurality ofadditional servers of the first blockchain node, wherein the nodeconfiguration information comprises a point-to-point routing table, anasymmetric public key, an asymmetric private key, and a node identity;receiving, by the first server of the first blockchain node, a servicerequest sent by a client, wherein the consensus network furthercomprises a plurality of additional blockchain nodes, the firstblockchain node and each node of the plurality of additional blockchainnodes of the consensus network comprising a corresponding plurality ofservers; storing the service request in at least one service memory ofthe first blockchain node; obtaining, by the first blockchain node andfrom a registration center, at least one address of at least one serverof the corresponding plurality of servers for each node of the pluralityof additional blockchain nodes in the consensus network; and sending theservice request to each additional blockchain node in the consensusnetwork based on the obtained at least one address, wherein eachadditional blockchain node stores the service request in a correspondingat least one service memory after receiving the service request.
 9. Thenon-transitory, computer-readable medium of claim 8, wherein theoperations comprise: registering the first server of the firstblockchain node with the registration center; receiving a message fromthe registration center; and in response to the message from theregistration center, sending an address of the first server to theregistration center.
 10. The non-transitory, computer-readable medium ofclaim 8, wherein sending the service request to each additionalblockchain node in the consensus network based on the obtained at leastone address comprises: selecting a first address from the obtained atleast one address of the corresponding plurality of servers of theplurality of additional blockchain nodes; and sending the servicerequest to the first address.
 11. The non-transitory, computer-readablemedium of claim 10, wherein selecting the first address is based on atleast one of a random selection, a load balancing status, or acombination thereof.
 12. The non-transitory, computer-readable medium ofclaim 8, wherein storing the service request in the at least one servicememory of the first blockchain node comprises: verifying the servicerequest is valid; and storing the service request in the at least oneservice memory of the first blockchain node in response to verifying theservice request is valid.
 13. The non-transitory, computer-readablemedium of claim 8, wherein the operations comprise: selecting, by thefirst blockchain node, the first server of the first blockchain node;obtaining, by the first server, at least one service request from the atleast one service memory of the first blockchain node; packaging, by thefirst server, the at least one service request into a preprocessingblock; and sending the preprocessing block to each additional blockchainnode in the consensus network, wherein each additional blockchain nodeperforms service consensus on the preprocessing block.
 14. Thenon-transitory, computer-readable medium of claim 8, wherein theoperations comprise: receiving a heartbeat detection message by thefirst server of the first blockchain node from the registration center.15. A computer-implemented system, comprising: one or more computers;and one or more computer memory devices interoperably coupled with theone or more computers and having tangible, non-transitory,machine-readable media storing one or more instructions that, whenexecuted by the one or more computers, perform one or more operationscomprising: sharing, from a first server of a first blockchain node in aconsensus network, node configuration information with a plurality ofadditional servers of the first blockchain node, wherein the nodeconfiguration information comprises a point-to-point routing table, anasymmetric public key, an asymmetric private key, and a node identity;receiving, by the first server of the first blockchain node, a servicerequest sent by a client, wherein the consensus network furthercomprises a plurality of additional blockchain nodes, the firstblockchain node and each node of the plurality of additional blockchainnodes of the consensus network comprising a corresponding plurality ofservers; storing the service request in at least one service memory ofthe first blockchain node; obtaining, by the first blockchain node andfrom a registration center, at least one address of at least one serverof the corresponding plurality of servers for each node of the pluralityof additional blockchain nodes in the consensus network; and sending theservice request to each additional blockchain node in the consensusnetwork based on the obtained at least one address, wherein eachadditional blockchain node stores the service request in a correspondingat least one service memory after receiving the service request.
 16. Thecomputer-implemented system of claim 15, wherein the operationscomprise: registering the first server of the first blockchain node withthe registration center; receiving a message from the registrationcenter; and in response to the message from the registration center,sending an address of the first server to the registration center. 17.The computer-implemented system of claim 15, wherein sending the servicerequest to each additional blockchain node in the consensus networkbased on the obtained at least one address comprises: selecting a firstaddress from the obtained at least one address of the correspondingplurality of servers of the plurality of additional blockchain nodes;and sending the service request to the first address.
 18. Thecomputer-implemented system of claim 17, wherein selecting the firstaddress is based on at least one of a random selection, a load balancingstatus, or a combination thereof.
 19. The computer-implemented system ofclaim 15, wherein storing the service request in the at least oneservice memory of the first blockchain node comprises: verifying theservice request is valid; and storing the service request in the atleast one service memory of the first blockchain node in response toverifying the service request is valid.
 20. The computer-implementedsystem of claim 15, wherein the operations comprise: selecting, by thefirst blockchain node, the first server of the first blockchain node;obtaining, by the first server, at least one service request from the atleast one service memory of the first blockchain node; packaging, by thefirst server, the at least one service request into a preprocessingblock; and sending the preprocessing block to each additional blockchainnode in the consensus network, wherein each additional blockchain nodeperforms service consensus on the preprocessing block.